<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 验证哥德巴赫猜想。一个偶数可以拆分成两个质数之和。 -->
    <script>
        var num = parseInt(prompt("请输入一个偶数",2));
        zm(num);
        function zhishu(a){
            var sum = 0;
            for (var i = 1; i <= a; i++){
                if (a % i ==0) {
                    sum++;
                }
            }
            if (sum == 2) {
                return true;
            }else{
                return false;
            }
        }
        function zm(a){
            for (var i = 2; i < a-2; i++) {
                var j = a - i;
                if (zhishu(i) && zhishu(j)) {
                    console.log(a+"="+i+"+"+j);
                }
            }
        }
    </script>
</body>
</html>